package com.baseproject.datasource.get.response;

import org.json.JSONArray;
import org.json.JSONObject;

import static com.baseproject.json.JsonUtils.createJSONObject;

/**
 * Created by hp on 2017/9/5.
 */

public class JSONArrayHandler extends BaseResponseHandler {

    JSONArray jsonArrayData;

    public JSONArrayHandler(JSONArray jsonArrayData) {
        this.jsonArrayData = jsonArrayData;
    }


    @Override
    public JSONArray getJSONArrayData() {
        if (jsonArrayData.length() != 0) {
            return jsonArrayData;
        }
        return null;
    }

    @Override
    public JSONObject getJSONObjectData() {
        return createJSONObject(jsonArrayData);
    }

}
